package com.yuexunit.finance.project.service;

import java.util.List;

import org.hibernate.criterion.DetachedCriteria;
import org.hibernate.criterion.Restrictions;

import com.yuexunit.finance.project.entity.FinanceRecordCorrespondingInfoEntity;
import com.yuexunit.inject.annotation.Implements;
import com.yuexunit.persist.PersistUtil;

/**
*@version 创建时间：2018年1月10日 上午10:28:39
*@author wenwenlong
*类说明
*/

@Implements(FinanceRecordCorrespondingInfoService.class)
public class FinanceRecordCorrespondingInfoServiceImpl implements FinanceRecordCorrespondingInfoService {

	@Override
	public Long createFinanceRecordCorrespondingInfo(FinanceRecordCorrespondingInfoEntity entity) {
		PersistUtil.insert(entity);
		return entity.getCorrespondingInfoId();
	}

	@Override
	public List<FinanceRecordCorrespondingInfoEntity> inquireFinanceRecordCorrespondingInfoList(
			Long settlementStatementId) {
		DetachedCriteria criteria = DetachedCriteria.forClass(FinanceRecordCorrespondingInfoEntity.class);
		if (null != settlementStatementId) {
			criteria.add(Restrictions.eq("settlementStatementId", settlementStatementId));
		}
		return PersistUtil.get(criteria);
	}
}
